/**
 * 
 */
package tests.board;

import java.util.ArrayList;

import junit.framework.TestCase;
import root.JChess;
import root.board.EmptyPlaceException;
import root.board.moviment.Moviment;
import root.board.moviment.Position;

/**
 * @author Calebe
 * 
 */
public class GetEnabledMovimentsBishop extends TestCase {
	JChess jchess;

	/**
	 * 
	 */
	public void testBishopAtStart() {
		jchess = new JChess();
		jchess.newGame();
		ArrayList<Moviment> moviments = new ArrayList<Moviment>();
		try {
			if (jchess.isPiecePresent(new Position(2, 0)))
				moviments = jchess.getEnabledMoviments(new Position(2, 0));
		} catch (EmptyPlaceException e) {
			e.printStackTrace();
		}
		assertEquals(0, moviments.size());

	}

	public void testFreeBishop() {
		jchess = new JChess();
		jchess.newGame();
		Position bishopPosition = new Position(2, 0), destinyPosition = new Position(4, 4);
		try {
			jchess.move(new Moviment(bishopPosition, destinyPosition));
		} catch (EmptyPlaceException e1) {
			e1.printStackTrace();
		}

		ArrayList<Moviment> moviments = new ArrayList<Moviment>();

		if (jchess.isPiecePresent(destinyPosition)) {
			try {
				moviments = jchess.getEnabledMoviments(destinyPosition);
			} catch (EmptyPlaceException e) {
				e.printStackTrace();
			}

		}
		assertEquals(8, moviments.size());

	}
}
